import request from '@/utils/http'

/**
 * 用户名登录
 * @param params
 */
export function loginUsername(params: any) {
	return request.post<Http.BaseResponse>({
		url: '/api/user/loginUsername',
		params: params
		// showSuccessMessage: true // 显示成功消息
		// showErrorMessage: false // 不显示错误消息
	})
}

/**
 * 获取用户列表
 * @param params
 */
export function getUserList(params: any) {
	return request.get<Http.BaseResponse>({
		url: '/api/user',
		params: params
	})
}

/**
 * 获取用户信息
 */
export function getUserInfo() {
	return request.get<Http.BaseResponse>({
		url: '/api/user/info'
	})
}

/**
 * 创建用户
 * @param params
 */
export function createUser(params: any) {
	return request.post<Http.BaseResponse>({
		url: '/api/user',
		params: params,
		showSuccessMessage: true
	})
}

/**
 * 更新用户
 * @param params
 */
export function updateUser(params: any) {
	return request.put<Http.BaseResponse>({
		url: '/api/user',
		params: params,
		showSuccessMessage: true
	})
}

/**
 * 更新用户密码
 * @param params
 */
export function updateUserPassword(params: any) {
	return request.put<Http.BaseResponse>({
		url: '/api/user/password',
		params: params,
		showSuccessMessage: true
	})
}